Create a unified RuleConfig abstraction#569
Conversation
CodSpeed Performance ReportMerging #569 will not alter performanceComparing Summary
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #569 +/- ##
=======================================
Coverage 97.27% 97.27%
=======================================
Files 87 87
Lines 4143 4152 +9
=======================================
+ Hits 4030 4039 +9
Misses 113 113 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a unified RuleConfig abstraction to replace the previous get_associated_ruff_rules method across tools and tests. Key changes include updating tests to use RuleConfig, refactoring methods in src/usethis/_tool.py and src/usethis/_core/tool.py to return and consume RuleConfig instances, and extracting a helper (_get_basic_rule_config) in use_ruff.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/usethis/test_usethis_tool.py | Updated tests to use get_rule_config and compare against RuleConfig |
| src/usethis/_tool.py | Removed get_associated_ruff_rules and introduced get_rule_config returning RuleConfig |
| src/usethis/_core/tool.py | Adjusted use_pytest and use_ruff to consume RuleConfig values and added _get_basic_rule_config helper |
Comments suppressed due to low confidence (2)
src/usethis/_core/tool.py:252
- [nitpick] Consider adding a brief inline comment to clarify why get_all_selected() (including both managed and unmanaged selected rules) is used when selecting rules, while only rule_config.selected is used when deselecting rules. This will help future maintainers understand the intended behavior.
RuffTool().select_rules(rule_config.get_all_selected())
src/usethis/_core/tool.py:361
- [nitpick] If _get_basic_rule_config is expected to be used in multiple contexts, consider refactoring it into a shared utility module for better modularity.
def _get_basic_rule_config() -> RuleConfig:
No description provided.